package com.dbumama.market.web.mobile.shop.controller;

import java.util.ArrayList;
import java.util.List;

import com.dbumama.market.model.Shop;
import com.dbumama.market.service.api.shop.ShopMobileResultDto;
import com.dbumama.market.web.core.annotation.RouteBind;
import com.dbumama.market.web.core.controller.BaseMobileController;

@RouteBind(path="shop")
public class ShopController extends BaseMobileController{
	
	public void index(){
		
		render("/shop/index.html");	
	}
	public void list(){
		List<ShopMobileResultDto> shopMobileResultDtos=new ArrayList<ShopMobileResultDto>();
		List<Shop> shops=Shop.dao.find("select * from " +Shop.table + " ORDER BY id ASC ");
		for(Shop shop:shops) {
			ShopMobileResultDto e=new ShopMobileResultDto();
			e.setId(String.valueOf(shop.getSellerId()));
			e.setShopName(shop.getShopName());
			e.setShopLogo(shop.getShopLogo());
			shopMobileResultDtos.add(e);
		}
		rendSuccessJson(shopMobileResultDtos);
	}

}
